<link rel="stylesheet" href="/styles/fileinput.css">
<script type="text/javascript" src="/js/fileinput.js"></script>
<script type="text/javascript" src="/js/fileinput_locale_zh.js"></script>
<h1>首页幻灯片</h1>
<table class="table table-hover">
    <thead>
    <tr>
      <th>#</th>
      <th>标题1</th>
      <th>标题2</th>
      <th>图片</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <% for (var i=0; i<data.length; i++) {%>
    <tr>
      <th scope="row"><%= i+1 %></th>
      <td><%= data[i].title %></td>
      <td><%= data[i].remark %></td>
      <td><div class="img-container"><img src="/slider_img/<%= data[i].img %>"></div></td>
      <td><a class="btn btn-primary" href="/admin/slider/deleteSlider/<%= data[i].id %>">删除</a></td>
    </tr>
    <% } %>
    </tbody>
</table>
<button type="button" id="btn-create" class="btn btn-primary">新增</button>
<div id="form-create" style="display: none">
  <form action="/admin/slider/createSlider" enctype="multipart/form-data" method="post">
    <div class="form-group">
      <label for="title-1">标题-1</label>
      <input type="text" class="form-control" id="title-1" name="title_1" placeholder="标题-1">
    </div>
    <div class="form-group">
      <label for="title-2">标题-2</label>
      <input type="text" class="form-control" id="title-2" name="title_2" placeholder="标题-2">
    </div>
    <div class="form-group">
      <label for="exampleInputFile">幻灯片图片</label>
      <input type="file" id="exampleInputFile" name="slider_img">
      <p class="help-block">大小不超过400k</p>
    </div>
    <button type="submit" class="btn btn-default">创建</button>
  </form>
</div>
<script>
  $(function () {
    $('#btn-create').click(function () {
      $('#form-create').show();
    })
  })
</script>
